<Query Kind="VBStatements">
  <Namespace>System.Runtime.CompilerServices</Namespace>
  <Namespace>MyExtensionMethods</Namespace>
</Query>

' What is an extension method?

'  1 - A method is a function that is relevant to a particular type of object.
'	   Ex:  Split is a method that belongs to Strings.
'  2 - Methods are called with this syntax:
'		<object>.<method_name>(p1, p2, p3...)
'  3 - Functions are called this way:
'		<function_name>(<object>, p1, p2, p3)

	Dim name = "Bill O'Reilly"
	
	' Regular functions are called with the name of the function first
	' with the parameters inside the function
	EncodeSQL(name).Dump("Regular function call")
	
	' Method calls
	name.EncodeSQL().Dump()
	
	'AddMr(name).Dump("Add

End Sub ' We need these TWO for our extension methods
End Class

Public Module MyExtensionMethods

	<Extension()> _
	Public Function EncodeSQL(text As String) As String
		return text.Replace("'", "''")
	End Function
	
	<Extension()> _
	Public Function AddMr(name as String) As String
		return "Mr. " & name
	End Function

End Module

Class FakeClass
Sub Fake